
import React from 'react';

export default (factory: () => Promise<any>, load = <></>) => props => {

    const [Ct, setCt] = React.useState<any>();

    React.useEffect(() => { factory().then(e => { setCt(e) }) }, [])

    return (Ct && Ct.default) ? <Ct.default {...props} /> : load;
}
